home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / sendun1a / flood.bas < prev    next >
Encoding:
BASIC Source File  |  1999-10-22  |  2.0 KB  |  84 lines

  1. Attribute VB_Name = "flood"
  2. Option Explicit
  3.  
  4. 'para evitar pasar repetidamente una $
  5. Dim fmsg As String
  6.   
  7. 'variable de flood
  8. Dim f As PictureBox
  9. Public Sub FloodDisplay(upperLimit, floodMessage As String)
  10.    
  11.    'establecet la variable a nivel del modulo de f
  12.    'igual a la forma padre
  13.     Set f = frmData.pix
  14.        
  15.    'inicializar
  16.    'blanco (color del texto)
  17.    'negro (el flujo)
  18.    'llenado s≤lido
  19.     f.BackColor = &HFFFFFF
  20.     f.ForeColor = &HFF0000
  21.     f.DrawMode = 10
  22.     f.FillStyle = 0
  23.        
  24.    'set the scalewidth equal to the
  25.    'upper limit of the items to count
  26.     f.ScaleWidth = upperLimit
  27.       
  28.     f.Cls
  29.     f.Visible = True
  30.        
  31.    'set a form-level variable for the flood message
  32.    'to avoid the need for continually passing a string
  33.     fmsg = floodMessage
  34.     
  35. End Sub
  36. Sub FloodHide()
  37.   
  38.   'hide the flood panel
  39.    f.Visible = False
  40.    f.Cls
  41.   
  42.   'free the memory used by the f object
  43.    Set f = Nothing
  44.   
  45. End Sub
  46. Public Sub FloodUpdateText(progress)
  47.  
  48.     Dim r As Long
  49.     Dim stNew   As String
  50.     
  51.    'make sure that the flood display hasn't already hit 100%
  52.  
  53.     If progress <= f.ScaleWidth Then
  54.    
  55.      'trap in case the code below attempts to set
  56.      'the scalewidth greater than the max allowable
  57.       If progress > f.ScaleWidth Then progress = f.ScaleWidth
  58.               
  59.      'clear the flood
  60.       f.Cls
  61.         
  62.      'calculate the string's X & Y coordinates for left-justified
  63.      'and vertically centered text and print the string
  64.       f.CurrentX = 2
  65.       f.CurrentY = (f.ScaleHeight - f.TextHeight(fmsg)) \ 2
  66.       
  67.       stNew = ""
  68.       stNew = fmsg & "..." & Format$(CLng((progress / f.ScaleWidth) * 100)) + "%"
  69.       f.Print stNew
  70.       
  71.       DoEvents
  72.         
  73.      'fill in the flood bar to the new progress length
  74.       f.Line (0, 0)-(progress, f.ScaleHeight), f.ForeColor, BF
  75.          
  76.       'f.Refresh
  77.      'REQUIRED: allow the flood to complete drawing
  78.       DoEvents
  79.     
  80.     End If
  81.  
  82. End Sub
  83.  
  84.